{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4f76161c",
   "metadata": {},
   "source": [
    "## 数值高效计算（Numpy科学计算库）> 【作业】阶段五模块三作业"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "41385af5",
   "metadata": {},
   "source": [
    "### 1.随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "537a2ace",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d98d9383",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0, 83,  2],\n",
       "       [93,  7, 47],\n",
       "       [27, 45, 85],\n",
       "       [17, 82, 42],\n",
       "       [28, 50, 79],\n",
       "       [76, 70, 62],\n",
       "       [82, 21, 13],\n",
       "       [52, 38, 21],\n",
       "       [51, 90, 29],\n",
       "       [56, 81, 65],\n",
       "       [80, 60, 29],\n",
       "       [91, 20, 75],\n",
       "       [48, 38, 64],\n",
       "       [14, 73, 58],\n",
       "       [86, 45, 93],\n",
       "       [ 1,  2, 18],\n",
       "       [88, 67, 88],\n",
       "       [44, 40, 58],\n",
       "       [51,  0, 20],\n",
       "       [86, 38, 73],\n",
       "       [40, 55, 96],\n",
       "       [ 1, 89,  1],\n",
       "       [48, 39, 50],\n",
       "       [69, 43, 59],\n",
       "       [38,  8, 12],\n",
       "       [48, 44, 94],\n",
       "       [15, 60, 61],\n",
       "       [41,  4, 73],\n",
       "       [68,  9, 49],\n",
       "       [76, 90, 83],\n",
       "       [ 1, 49, 12],\n",
       "       [52, 87,  1],\n",
       "       [38,  4, 58],\n",
       "       [88,  4, 10],\n",
       "       [42, 50, 72],\n",
       "       [ 4, 50, 75],\n",
       "       [96, 82, 64],\n",
       "       [52, 70, 10],\n",
       "       [58, 93,  8],\n",
       "       [59, 67,  3],\n",
       "       [17, 47, 73],\n",
       "       [55, 61, 97],\n",
       "       [15,  8, 66],\n",
       "       [96, 32, 12],\n",
       "       [45, 23, 88],\n",
       "       [23, 74, 25],\n",
       "       [24,  8, 89],\n",
       "       [82, 29, 22],\n",
       "       [38, 47, 52],\n",
       "       [94, 70, 92]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[84, 99, 18],\n",
       "       [40, 13, 70],\n",
       "       [93,  5, 73],\n",
       "       [23, 37, 45],\n",
       "       [47, 16, 63],\n",
       "       [75, 67, 96],\n",
       "       [23, 46, 67],\n",
       "       [27, 30, 64],\n",
       "       [15, 27, 32],\n",
       "       [64, 66, 92],\n",
       "       [67, 51, 33],\n",
       "       [41, 76, 40],\n",
       "       [13, 64,  3],\n",
       "       [28, 78, 26],\n",
       "       [81, 64, 35],\n",
       "       [52, 49, 56],\n",
       "       [12, 52, 36],\n",
       "       [16, 34, 18],\n",
       "       [76, 49, 12],\n",
       "       [82, 21, 91],\n",
       "       [43, 75, 27],\n",
       "       [ 0, 89, 47],\n",
       "       [27, 71, 68],\n",
       "       [22, 18, 74],\n",
       "       [47,  7,  5],\n",
       "       [56,  0,  6],\n",
       "       [24, 42, 44],\n",
       "       [59, 49, 54],\n",
       "       [99, 24, 83],\n",
       "       [12, 25,  1],\n",
       "       [44, 65, 18],\n",
       "       [49, 93, 93],\n",
       "       [81, 90, 16],\n",
       "       [ 2, 56, 32],\n",
       "       [97,  2,  7],\n",
       "       [43, 44, 32],\n",
       "       [74,  0, 56],\n",
       "       [23, 57, 57],\n",
       "       [21, 42, 13],\n",
       "       [55, 95, 50],\n",
       "       [22, 32, 74],\n",
       "       [17,  6, 90],\n",
       "       [13, 91, 80],\n",
       "       [75, 95, 85],\n",
       "       [20, 24, 61],\n",
       "       [ 5, 31, 83],\n",
       "       [20, 50, 83],\n",
       "       [25, 59, 28],\n",
       "       [33, 41, 31],\n",
       "       [42, 51,  7]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[54, 36,  5],\n",
       "       [99,  8, 35],\n",
       "       [41, 62, 55],\n",
       "       [ 1, 16, 98],\n",
       "       [33, 61, 74],\n",
       "       [72, 26, 87],\n",
       "       [98, 38,  2],\n",
       "       [64, 79, 73],\n",
       "       [59, 21, 71],\n",
       "       [73, 60, 29],\n",
       "       [27, 31, 38],\n",
       "       [15, 23, 67],\n",
       "       [96, 58, 74],\n",
       "       [84, 69, 31],\n",
       "       [14, 79, 58],\n",
       "       [50, 77, 83],\n",
       "       [38, 16, 50],\n",
       "       [86, 38, 25],\n",
       "       [55, 34, 64],\n",
       "       [37, 34, 16],\n",
       "       [12, 44,  1],\n",
       "       [99, 47, 63],\n",
       "       [71, 20, 88],\n",
       "       [18,  9, 46],\n",
       "       [94, 63, 53],\n",
       "       [79, 83, 65],\n",
       "       [24, 47, 58],\n",
       "       [76, 56, 77],\n",
       "       [57, 85,  0],\n",
       "       [57, 57, 42],\n",
       "       [66,  3, 61],\n",
       "       [31, 39,  8],\n",
       "       [79, 19, 89],\n",
       "       [38, 35, 25],\n",
       "       [56, 93, 95],\n",
       "       [ 7, 11, 80],\n",
       "       [50, 12, 59],\n",
       "       [29, 30, 51],\n",
       "       [50, 24, 37],\n",
       "       [65, 44, 54],\n",
       "       [94, 88,  4],\n",
       "       [33, 42, 65],\n",
       "       [22, 40, 65],\n",
       "       [47, 24, 36],\n",
       "       [65, 31, 65],\n",
       "       [96, 56, 63],\n",
       "       [72, 29, 21],\n",
       "       [67, 37, 56],\n",
       "       [20, 47, 70],\n",
       "       [68, 55, 77]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[33, 28, 40],\n",
       "       [97, 77, 76],\n",
       "       [17, 15, 79],\n",
       "       [23, 35, 44],\n",
       "       [21, 40, 89],\n",
       "       [35,  4, 77],\n",
       "       [87,  5, 73],\n",
       "       [44, 52, 39],\n",
       "       [38, 40, 74],\n",
       "       [36, 41, 65],\n",
       "       [ 0, 59, 58],\n",
       "       [62,  4, 16],\n",
       "       [16, 19, 12],\n",
       "       [70, 19, 14],\n",
       "       [31, 42, 56],\n",
       "       [59, 70, 77],\n",
       "       [15, 81, 33],\n",
       "       [60, 95, 24],\n",
       "       [51, 46, 99],\n",
       "       [10, 66,  4],\n",
       "       [58, 84, 46],\n",
       "       [66, 84, 83],\n",
       "       [50, 39, 19],\n",
       "       [11,  3, 16],\n",
       "       [19, 49, 38],\n",
       "       [27, 47, 65],\n",
       "       [76, 54, 28],\n",
       "       [ 0, 39, 37],\n",
       "       [85, 72, 39],\n",
       "       [ 8, 56,  6],\n",
       "       [62, 40, 48],\n",
       "       [93, 80, 63],\n",
       "       [14, 15, 57],\n",
       "       [14, 29, 40],\n",
       "       [52, 46, 19],\n",
       "       [81, 81, 49],\n",
       "       [ 4, 21, 87],\n",
       "       [ 3, 55, 97],\n",
       "       [56, 41, 22],\n",
       "       [70, 39, 74],\n",
       "       [36, 46, 88],\n",
       "       [84, 36, 65],\n",
       "       [45, 86, 94],\n",
       "       [70, 20, 12],\n",
       "       [46, 37, 96],\n",
       "       [98, 48, 51],\n",
       "       [98, 48, 98],\n",
       "       [97, 20, 38],\n",
       "       [29, 44, 80],\n",
       "       [22, 70, 58]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[ 8, 14, 95],\n",
       "       [55, 31, 59],\n",
       "       [86, 74, 40],\n",
       "       [31, 30, 34],\n",
       "       [94, 64,  5],\n",
       "       [45, 79, 23],\n",
       "       [78,  3, 77],\n",
       "       [33, 52, 69],\n",
       "       [32, 20, 10],\n",
       "       [66, 29, 22],\n",
       "       [ 0, 30, 12],\n",
       "       [56, 99, 36],\n",
       "       [15, 17, 42],\n",
       "       [72, 66, 43],\n",
       "       [89, 56, 13],\n",
       "       [ 6, 47, 80],\n",
       "       [79, 13, 49],\n",
       "       [24, 75, 22],\n",
       "       [65, 15, 12],\n",
       "       [62, 73, 63],\n",
       "       [48, 20, 13],\n",
       "       [52, 71, 20],\n",
       "       [75, 53, 99],\n",
       "       [64, 61, 17],\n",
       "       [13, 88, 85],\n",
       "       [78, 61, 98],\n",
       "       [ 4, 66, 41],\n",
       "       [48, 46, 95],\n",
       "       [39, 72, 89],\n",
       "       [33, 37, 47],\n",
       "       [48, 77, 11],\n",
       "       [77, 36,  9],\n",
       "       [43, 48, 40],\n",
       "       [54, 10, 94],\n",
       "       [57, 45, 94],\n",
       "       [76, 89, 67],\n",
       "       [33, 58, 95],\n",
       "       [60, 12, 80],\n",
       "       [70, 96, 20],\n",
       "       [94, 94, 77],\n",
       "       [59, 49, 25],\n",
       "       [36, 38, 54],\n",
       "       [26, 74, 90],\n",
       "       [76, 55, 66],\n",
       "       [67, 18, 26],\n",
       "       [72, 51, 48],\n",
       "       [ 5, 65, 45],\n",
       "       [79, 15, 63],\n",
       "       [54, 69, 53],\n",
       "       [95, 19,  6]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[81,  5,  3],\n",
       "       [66,  5, 98],\n",
       "       [11, 58,  5],\n",
       "       [59, 30, 52],\n",
       "       [25, 72, 83],\n",
       "       [71, 22, 66],\n",
       "       [92, 77, 78],\n",
       "       [86, 53, 61],\n",
       "       [55, 18, 41],\n",
       "       [62,  2, 15],\n",
       "       [11, 59, 97],\n",
       "       [30, 18, 67],\n",
       "       [89, 81, 36],\n",
       "       [56, 97, 64],\n",
       "       [ 4, 32, 49],\n",
       "       [82, 18, 46],\n",
       "       [82, 25, 91],\n",
       "       [ 9, 44, 37],\n",
       "       [92, 11, 21],\n",
       "       [57, 85, 14],\n",
       "       [ 1, 21, 98],\n",
       "       [29, 20, 78],\n",
       "       [ 1, 95, 62],\n",
       "       [22, 33, 47],\n",
       "       [ 5, 11, 97],\n",
       "       [75,  9, 30],\n",
       "       [70, 41, 27],\n",
       "       [14, 19, 89],\n",
       "       [34, 60, 63],\n",
       "       [24, 88, 53],\n",
       "       [17,  0, 20],\n",
       "       [ 1,  3, 26],\n",
       "       [64, 98, 94],\n",
       "       [50, 88, 91],\n",
       "       [54, 60, 10],\n",
       "       [39, 35,  0],\n",
       "       [16, 48, 29],\n",
       "       [ 2, 21, 69],\n",
       "       [27, 66, 47],\n",
       "       [55, 39, 49],\n",
       "       [86, 74, 74],\n",
       "       [ 6, 33, 86],\n",
       "       [16, 36, 63],\n",
       "       [50, 28, 11],\n",
       "       [ 5, 91, 16],\n",
       "       [22,  7, 19],\n",
       "       [59,  7, 75],\n",
       "       [79, 77, 71],\n",
       "       [54, 88,  5],\n",
       "       [92, 12, 39]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "class_score1 = np.random.randint(0,100,size = (50,3))\n",
    "class_score2 = np.random.randint(0,100,size = (50,3))\n",
    "class_score3 = np.random.randint(0,100,size = (50,3))\n",
    "class_score4 = np.random.randint(0,100,size = (50,3))\n",
    "class_score5 = np.random.randint(0,100,size = (50,3))\n",
    "class_score6 = np.random.randint(0,100,size = (50,3))\n",
    "\n",
    "display(class_score1,class_score2,class_score3,class_score4,class_score5,class_score6)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f6d6b47a",
   "metadata": {},
   "source": [
    "### 2.将六个班的考试成绩进行合并得到score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d3345919",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0, 83,  2],\n",
       "       [93,  7, 47],\n",
       "       [27, 45, 85],\n",
       "       [17, 82, 42],\n",
       "       [28, 50, 79],\n",
       "       [76, 70, 62],\n",
       "       [82, 21, 13],\n",
       "       [52, 38, 21],\n",
       "       [51, 90, 29],\n",
       "       [56, 81, 65],\n",
       "       [80, 60, 29],\n",
       "       [91, 20, 75],\n",
       "       [48, 38, 64],\n",
       "       [14, 73, 58],\n",
       "       [86, 45, 93],\n",
       "       [ 1,  2, 18],\n",
       "       [88, 67, 88],\n",
       "       [44, 40, 58],\n",
       "       [51,  0, 20],\n",
       "       [86, 38, 73],\n",
       "       [40, 55, 96],\n",
       "       [ 1, 89,  1],\n",
       "       [48, 39, 50],\n",
       "       [69, 43, 59],\n",
       "       [38,  8, 12],\n",
       "       [48, 44, 94],\n",
       "       [15, 60, 61],\n",
       "       [41,  4, 73],\n",
       "       [68,  9, 49],\n",
       "       [76, 90, 83],\n",
       "       [ 1, 49, 12],\n",
       "       [52, 87,  1],\n",
       "       [38,  4, 58],\n",
       "       [88,  4, 10],\n",
       "       [42, 50, 72],\n",
       "       [ 4, 50, 75],\n",
       "       [96, 82, 64],\n",
       "       [52, 70, 10],\n",
       "       [58, 93,  8],\n",
       "       [59, 67,  3],\n",
       "       [17, 47, 73],\n",
       "       [55, 61, 97],\n",
       "       [15,  8, 66],\n",
       "       [96, 32, 12],\n",
       "       [45, 23, 88],\n",
       "       [23, 74, 25],\n",
       "       [24,  8, 89],\n",
       "       [82, 29, 22],\n",
       "       [38, 47, 52],\n",
       "       [94, 70, 92],\n",
       "       [84, 99, 18],\n",
       "       [40, 13, 70],\n",
       "       [93,  5, 73],\n",
       "       [23, 37, 45],\n",
       "       [47, 16, 63],\n",
       "       [75, 67, 96],\n",
       "       [23, 46, 67],\n",
       "       [27, 30, 64],\n",
       "       [15, 27, 32],\n",
       "       [64, 66, 92],\n",
       "       [67, 51, 33],\n",
       "       [41, 76, 40],\n",
       "       [13, 64,  3],\n",
       "       [28, 78, 26],\n",
       "       [81, 64, 35],\n",
       "       [52, 49, 56],\n",
       "       [12, 52, 36],\n",
       "       [16, 34, 18],\n",
       "       [76, 49, 12],\n",
       "       [82, 21, 91],\n",
       "       [43, 75, 27],\n",
       "       [ 0, 89, 47],\n",
       "       [27, 71, 68],\n",
       "       [22, 18, 74],\n",
       "       [47,  7,  5],\n",
       "       [56,  0,  6],\n",
       "       [24, 42, 44],\n",
       "       [59, 49, 54],\n",
       "       [99, 24, 83],\n",
       "       [12, 25,  1],\n",
       "       [44, 65, 18],\n",
       "       [49, 93, 93],\n",
       "       [81, 90, 16],\n",
       "       [ 2, 56, 32],\n",
       "       [97,  2,  7],\n",
       "       [43, 44, 32],\n",
       "       [74,  0, 56],\n",
       "       [23, 57, 57],\n",
       "       [21, 42, 13],\n",
       "       [55, 95, 50],\n",
       "       [22, 32, 74],\n",
       "       [17,  6, 90],\n",
       "       [13, 91, 80],\n",
       "       [75, 95, 85],\n",
       "       [20, 24, 61],\n",
       "       [ 5, 31, 83],\n",
       "       [20, 50, 83],\n",
       "       [25, 59, 28],\n",
       "       [33, 41, 31],\n",
       "       [42, 51,  7],\n",
       "       [54, 36,  5],\n",
       "       [99,  8, 35],\n",
       "       [41, 62, 55],\n",
       "       [ 1, 16, 98],\n",
       "       [33, 61, 74],\n",
       "       [72, 26, 87],\n",
       "       [98, 38,  2],\n",
       "       [64, 79, 73],\n",
       "       [59, 21, 71],\n",
       "       [73, 60, 29],\n",
       "       [27, 31, 38],\n",
       "       [15, 23, 67],\n",
       "       [96, 58, 74],\n",
       "       [84, 69, 31],\n",
       "       [14, 79, 58],\n",
       "       [50, 77, 83],\n",
       "       [38, 16, 50],\n",
       "       [86, 38, 25],\n",
       "       [55, 34, 64],\n",
       "       [37, 34, 16],\n",
       "       [12, 44,  1],\n",
       "       [99, 47, 63],\n",
       "       [71, 20, 88],\n",
       "       [18,  9, 46],\n",
       "       [94, 63, 53],\n",
       "       [79, 83, 65],\n",
       "       [24, 47, 58],\n",
       "       [76, 56, 77],\n",
       "       [57, 85,  0],\n",
       "       [57, 57, 42],\n",
       "       [66,  3, 61],\n",
       "       [31, 39,  8],\n",
       "       [79, 19, 89],\n",
       "       [38, 35, 25],\n",
       "       [56, 93, 95],\n",
       "       [ 7, 11, 80],\n",
       "       [50, 12, 59],\n",
       "       [29, 30, 51],\n",
       "       [50, 24, 37],\n",
       "       [65, 44, 54],\n",
       "       [94, 88,  4],\n",
       "       [33, 42, 65],\n",
       "       [22, 40, 65],\n",
       "       [47, 24, 36],\n",
       "       [65, 31, 65],\n",
       "       [96, 56, 63],\n",
       "       [72, 29, 21],\n",
       "       [67, 37, 56],\n",
       "       [20, 47, 70],\n",
       "       [68, 55, 77],\n",
       "       [33, 28, 40],\n",
       "       [97, 77, 76],\n",
       "       [17, 15, 79],\n",
       "       [23, 35, 44],\n",
       "       [21, 40, 89],\n",
       "       [35,  4, 77],\n",
       "       [87,  5, 73],\n",
       "       [44, 52, 39],\n",
       "       [38, 40, 74],\n",
       "       [36, 41, 65],\n",
       "       [ 0, 59, 58],\n",
       "       [62,  4, 16],\n",
       "       [16, 19, 12],\n",
       "       [70, 19, 14],\n",
       "       [31, 42, 56],\n",
       "       [59, 70, 77],\n",
       "       [15, 81, 33],\n",
       "       [60, 95, 24],\n",
       "       [51, 46, 99],\n",
       "       [10, 66,  4],\n",
       "       [58, 84, 46],\n",
       "       [66, 84, 83],\n",
       "       [50, 39, 19],\n",
       "       [11,  3, 16],\n",
       "       [19, 49, 38],\n",
       "       [27, 47, 65],\n",
       "       [76, 54, 28],\n",
       "       [ 0, 39, 37],\n",
       "       [85, 72, 39],\n",
       "       [ 8, 56,  6],\n",
       "       [62, 40, 48],\n",
       "       [93, 80, 63],\n",
       "       [14, 15, 57],\n",
       "       [14, 29, 40],\n",
       "       [52, 46, 19],\n",
       "       [81, 81, 49],\n",
       "       [ 4, 21, 87],\n",
       "       [ 3, 55, 97],\n",
       "       [56, 41, 22],\n",
       "       [70, 39, 74],\n",
       "       [36, 46, 88],\n",
       "       [84, 36, 65],\n",
       "       [45, 86, 94],\n",
       "       [70, 20, 12],\n",
       "       [46, 37, 96],\n",
       "       [98, 48, 51],\n",
       "       [98, 48, 98],\n",
       "       [97, 20, 38],\n",
       "       [29, 44, 80],\n",
       "       [22, 70, 58],\n",
       "       [ 8, 14, 95],\n",
       "       [55, 31, 59],\n",
       "       [86, 74, 40],\n",
       "       [31, 30, 34],\n",
       "       [94, 64,  5],\n",
       "       [45, 79, 23],\n",
       "       [78,  3, 77],\n",
       "       [33, 52, 69],\n",
       "       [32, 20, 10],\n",
       "       [66, 29, 22],\n",
       "       [ 0, 30, 12],\n",
       "       [56, 99, 36],\n",
       "       [15, 17, 42],\n",
       "       [72, 66, 43],\n",
       "       [89, 56, 13],\n",
       "       [ 6, 47, 80],\n",
       "       [79, 13, 49],\n",
       "       [24, 75, 22],\n",
       "       [65, 15, 12],\n",
       "       [62, 73, 63],\n",
       "       [48, 20, 13],\n",
       "       [52, 71, 20],\n",
       "       [75, 53, 99],\n",
       "       [64, 61, 17],\n",
       "       [13, 88, 85],\n",
       "       [78, 61, 98],\n",
       "       [ 4, 66, 41],\n",
       "       [48, 46, 95],\n",
       "       [39, 72, 89],\n",
       "       [33, 37, 47],\n",
       "       [48, 77, 11],\n",
       "       [77, 36,  9],\n",
       "       [43, 48, 40],\n",
       "       [54, 10, 94],\n",
       "       [57, 45, 94],\n",
       "       [76, 89, 67],\n",
       "       [33, 58, 95],\n",
       "       [60, 12, 80],\n",
       "       [70, 96, 20],\n",
       "       [94, 94, 77],\n",
       "       [59, 49, 25],\n",
       "       [36, 38, 54],\n",
       "       [26, 74, 90],\n",
       "       [76, 55, 66],\n",
       "       [67, 18, 26],\n",
       "       [72, 51, 48],\n",
       "       [ 5, 65, 45],\n",
       "       [79, 15, 63],\n",
       "       [54, 69, 53],\n",
       "       [95, 19,  6],\n",
       "       [81,  5,  3],\n",
       "       [66,  5, 98],\n",
       "       [11, 58,  5],\n",
       "       [59, 30, 52],\n",
       "       [25, 72, 83],\n",
       "       [71, 22, 66],\n",
       "       [92, 77, 78],\n",
       "       [86, 53, 61],\n",
       "       [55, 18, 41],\n",
       "       [62,  2, 15],\n",
       "       [11, 59, 97],\n",
       "       [30, 18, 67],\n",
       "       [89, 81, 36],\n",
       "       [56, 97, 64],\n",
       "       [ 4, 32, 49],\n",
       "       [82, 18, 46],\n",
       "       [82, 25, 91],\n",
       "       [ 9, 44, 37],\n",
       "       [92, 11, 21],\n",
       "       [57, 85, 14],\n",
       "       [ 1, 21, 98],\n",
       "       [29, 20, 78],\n",
       "       [ 1, 95, 62],\n",
       "       [22, 33, 47],\n",
       "       [ 5, 11, 97],\n",
       "       [75,  9, 30],\n",
       "       [70, 41, 27],\n",
       "       [14, 19, 89],\n",
       "       [34, 60, 63],\n",
       "       [24, 88, 53],\n",
       "       [17,  0, 20],\n",
       "       [ 1,  3, 26],\n",
       "       [64, 98, 94],\n",
       "       [50, 88, 91],\n",
       "       [54, 60, 10],\n",
       "       [39, 35,  0],\n",
       "       [16, 48, 29],\n",
       "       [ 2, 21, 69],\n",
       "       [27, 66, 47],\n",
       "       [55, 39, 49],\n",
       "       [86, 74, 74],\n",
       "       [ 6, 33, 86],\n",
       "       [16, 36, 63],\n",
       "       [50, 28, 11],\n",
       "       [ 5, 91, 16],\n",
       "       [22,  7, 19],\n",
       "       [59,  7, 75],\n",
       "       [79, 77, 71],\n",
       "       [54, 88,  5],\n",
       "       [92, 12, 39]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score = np.concatenate([class_score1,class_score2,class_score3,class_score4,class_score5,class_score6])\n",
    "score"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31ba6f96",
   "metadata": {},
   "source": [
    "### 3.生成性别数组sex，水平叠加数组sex和score得到data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "cceed25d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  0, 83,  2],\n",
       "       [ 0, 93,  7, 47],\n",
       "       [ 0, 27, 45, 85],\n",
       "       ...,\n",
       "       [ 1, 79, 77, 71],\n",
       "       [ 0, 54, 88,  5],\n",
       "       [ 0, 92, 12, 39]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 0 代表男性；1 代表女性\n",
    "sex = np.random.randint(0,2,size = (300,1))\n",
    "data = np.hstack((sex,score))\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "88701ebe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  0, 83,  2],\n",
       "       [ 0, 93,  7, 47],\n",
       "       [ 0, 27, 45, 85],\n",
       "       ...,\n",
       "       [ 1, 79, 77, 71],\n",
       "       [ 0, 54, 88,  5],\n",
       "       [ 0, 92, 12, 39]])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2 = np.concatenate([sex,score],axis = 1)\n",
    "data2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b95f90af",
   "metadata": {},
   "source": [
    "### 4.分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7f403b0e",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0., 83.,  2.],\n",
       "       [17., 82., 42.],\n",
       "       [76., 70., 62.],\n",
       "       [52., 38., 21.],\n",
       "       [56., 81., 65.],\n",
       "       [48., 38., 64.],\n",
       "       [14., 73., 58.],\n",
       "       [88., 67., 88.],\n",
       "       [44., 40., 58.],\n",
       "       [86., 38., 73.],\n",
       "       [38.,  8., 12.],\n",
       "       [48., 44., 94.],\n",
       "       [15., 60., 61.],\n",
       "       [76., 90., 83.],\n",
       "       [52., 87.,  1.],\n",
       "       [38.,  4., 58.],\n",
       "       [88.,  4., 10.],\n",
       "       [96., 82., 64.],\n",
       "       [52., 70., 10.],\n",
       "       [55., 61., 97.],\n",
       "       [15.,  8., 66.],\n",
       "       [96., 32., 12.],\n",
       "       [45., 23., 88.],\n",
       "       [94., 70., 92.],\n",
       "       [40., 13., 70.],\n",
       "       [93.,  5., 73.],\n",
       "       [47., 16., 63.],\n",
       "       [15., 27., 32.],\n",
       "       [64., 66., 92.],\n",
       "       [67., 51., 33.],\n",
       "       [41., 76., 40.],\n",
       "       [13., 64.,  3.],\n",
       "       [28., 78., 26.],\n",
       "       [81., 64., 35.],\n",
       "       [12., 52., 36.],\n",
       "       [76., 49., 12.],\n",
       "       [82., 21., 91.],\n",
       "       [43., 75., 27.],\n",
       "       [27., 71., 68.],\n",
       "       [22., 18., 74.],\n",
       "       [47.,  7.,  5.],\n",
       "       [59., 49., 54.],\n",
       "       [99., 24., 83.],\n",
       "       [49., 93., 93.],\n",
       "       [81., 90., 16.],\n",
       "       [97.,  2.,  7.],\n",
       "       [21., 42., 13.],\n",
       "       [55., 95., 50.],\n",
       "       [17.,  6., 90.],\n",
       "       [33., 41., 31.],\n",
       "       [42., 51.,  7.],\n",
       "       [ 1., 16., 98.],\n",
       "       [33., 61., 74.],\n",
       "       [98., 38.,  2.],\n",
       "       [73., 60., 29.],\n",
       "       [15., 23., 67.],\n",
       "       [96., 58., 74.],\n",
       "       [84., 69., 31.],\n",
       "       [14., 79., 58.],\n",
       "       [38., 16., 50.],\n",
       "       [55., 34., 64.],\n",
       "       [37., 34., 16.],\n",
       "       [99., 47., 63.],\n",
       "       [18.,  9., 46.],\n",
       "       [94., 63., 53.],\n",
       "       [79., 83., 65.],\n",
       "       [76., 56., 77.],\n",
       "       [66.,  3., 61.],\n",
       "       [79., 19., 89.],\n",
       "       [50., 24., 37.],\n",
       "       [94., 88.,  4.],\n",
       "       [33., 42., 65.],\n",
       "       [22., 40., 65.],\n",
       "       [47., 24., 36.],\n",
       "       [33., 28., 40.],\n",
       "       [97., 77., 76.],\n",
       "       [17., 15., 79.],\n",
       "       [23., 35., 44.],\n",
       "       [44., 52., 39.],\n",
       "       [36., 41., 65.],\n",
       "       [ 0., 59., 58.],\n",
       "       [31., 42., 56.],\n",
       "       [60., 95., 24.],\n",
       "       [51., 46., 99.],\n",
       "       [58., 84., 46.],\n",
       "       [66., 84., 83.],\n",
       "       [50., 39., 19.],\n",
       "       [11.,  3., 16.],\n",
       "       [27., 47., 65.],\n",
       "       [ 0., 39., 37.],\n",
       "       [85., 72., 39.],\n",
       "       [ 8., 56.,  6.],\n",
       "       [62., 40., 48.],\n",
       "       [93., 80., 63.],\n",
       "       [14., 29., 40.],\n",
       "       [52., 46., 19.],\n",
       "       [ 3., 55., 97.],\n",
       "       [84., 36., 65.],\n",
       "       [46., 37., 96.],\n",
       "       [98., 48., 51.],\n",
       "       [98., 48., 98.],\n",
       "       [97., 20., 38.],\n",
       "       [29., 44., 80.],\n",
       "       [22., 70., 58.],\n",
       "       [45., 79., 23.],\n",
       "       [32., 20., 10.],\n",
       "       [66., 29., 22.],\n",
       "       [ 0., 30., 12.],\n",
       "       [56., 99., 36.],\n",
       "       [15., 17., 42.],\n",
       "       [ 6., 47., 80.],\n",
       "       [79., 13., 49.],\n",
       "       [65., 15., 12.],\n",
       "       [62., 73., 63.],\n",
       "       [48., 20., 13.],\n",
       "       [52., 71., 20.],\n",
       "       [64., 61., 17.],\n",
       "       [78., 61., 98.],\n",
       "       [43., 48., 40.],\n",
       "       [57., 45., 94.],\n",
       "       [60., 12., 80.],\n",
       "       [70., 96., 20.],\n",
       "       [94., 94., 77.],\n",
       "       [36., 38., 54.],\n",
       "       [76., 55., 66.],\n",
       "       [72., 51., 48.],\n",
       "       [ 5., 65., 45.],\n",
       "       [81.,  5.,  3.],\n",
       "       [11., 58.,  5.],\n",
       "       [59., 30., 52.],\n",
       "       [25., 72., 83.],\n",
       "       [92., 77., 78.],\n",
       "       [55., 18., 41.],\n",
       "       [89., 81., 36.],\n",
       "       [56., 97., 64.],\n",
       "       [82., 18., 46.],\n",
       "       [82., 25., 91.],\n",
       "       [22., 33., 47.],\n",
       "       [70., 41., 27.],\n",
       "       [14., 19., 89.],\n",
       "       [64., 98., 94.],\n",
       "       [50., 88., 91.],\n",
       "       [39., 35.,  0.],\n",
       "       [16., 48., 29.],\n",
       "       [86., 74., 74.],\n",
       "       [ 6., 33., 86.],\n",
       "       [50., 28., 11.],\n",
       "       [79., 77., 71.]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[93.,  7., 47.],\n",
       "       [27., 45., 85.],\n",
       "       [28., 50., 79.],\n",
       "       [82., 21., 13.],\n",
       "       [51., 90., 29.],\n",
       "       [80., 60., 29.],\n",
       "       [91., 20., 75.],\n",
       "       [86., 45., 93.],\n",
       "       [ 1.,  2., 18.],\n",
       "       [51.,  0., 20.],\n",
       "       [40., 55., 96.],\n",
       "       [ 1., 89.,  1.],\n",
       "       [48., 39., 50.],\n",
       "       [69., 43., 59.],\n",
       "       [41.,  4., 73.],\n",
       "       [68.,  9., 49.],\n",
       "       [ 1., 49., 12.],\n",
       "       [42., 50., 72.],\n",
       "       [ 4., 50., 75.],\n",
       "       [58., 93.,  8.],\n",
       "       [59., 67.,  3.],\n",
       "       [17., 47., 73.],\n",
       "       [23., 74., 25.],\n",
       "       [24.,  8., 89.],\n",
       "       [82., 29., 22.],\n",
       "       [38., 47., 52.],\n",
       "       [84., 99., 18.],\n",
       "       [23., 37., 45.],\n",
       "       [75., 67., 96.],\n",
       "       [23., 46., 67.],\n",
       "       [27., 30., 64.],\n",
       "       [52., 49., 56.],\n",
       "       [16., 34., 18.],\n",
       "       [ 0., 89., 47.],\n",
       "       [56.,  0.,  6.],\n",
       "       [24., 42., 44.],\n",
       "       [12., 25.,  1.],\n",
       "       [44., 65., 18.],\n",
       "       [ 2., 56., 32.],\n",
       "       [43., 44., 32.],\n",
       "       [74.,  0., 56.],\n",
       "       [23., 57., 57.],\n",
       "       [22., 32., 74.],\n",
       "       [13., 91., 80.],\n",
       "       [75., 95., 85.],\n",
       "       [20., 24., 61.],\n",
       "       [ 5., 31., 83.],\n",
       "       [20., 50., 83.],\n",
       "       [25., 59., 28.],\n",
       "       [54., 36.,  5.],\n",
       "       [99.,  8., 35.],\n",
       "       [41., 62., 55.],\n",
       "       [72., 26., 87.],\n",
       "       [64., 79., 73.],\n",
       "       [59., 21., 71.],\n",
       "       [27., 31., 38.],\n",
       "       [50., 77., 83.],\n",
       "       [86., 38., 25.],\n",
       "       [12., 44.,  1.],\n",
       "       [71., 20., 88.],\n",
       "       [24., 47., 58.],\n",
       "       [57., 85.,  0.],\n",
       "       [57., 57., 42.],\n",
       "       [31., 39.,  8.],\n",
       "       [38., 35., 25.],\n",
       "       [56., 93., 95.],\n",
       "       [ 7., 11., 80.],\n",
       "       [50., 12., 59.],\n",
       "       [29., 30., 51.],\n",
       "       [65., 44., 54.],\n",
       "       [65., 31., 65.],\n",
       "       [96., 56., 63.],\n",
       "       [72., 29., 21.],\n",
       "       [67., 37., 56.],\n",
       "       [20., 47., 70.],\n",
       "       [68., 55., 77.],\n",
       "       [21., 40., 89.],\n",
       "       [35.,  4., 77.],\n",
       "       [87.,  5., 73.],\n",
       "       [38., 40., 74.],\n",
       "       [62.,  4., 16.],\n",
       "       [16., 19., 12.],\n",
       "       [70., 19., 14.],\n",
       "       [59., 70., 77.],\n",
       "       [15., 81., 33.],\n",
       "       [10., 66.,  4.],\n",
       "       [19., 49., 38.],\n",
       "       [76., 54., 28.],\n",
       "       [14., 15., 57.],\n",
       "       [81., 81., 49.],\n",
       "       [ 4., 21., 87.],\n",
       "       [56., 41., 22.],\n",
       "       [70., 39., 74.],\n",
       "       [36., 46., 88.],\n",
       "       [45., 86., 94.],\n",
       "       [70., 20., 12.],\n",
       "       [ 8., 14., 95.],\n",
       "       [55., 31., 59.],\n",
       "       [86., 74., 40.],\n",
       "       [31., 30., 34.],\n",
       "       [94., 64.,  5.],\n",
       "       [78.,  3., 77.],\n",
       "       [33., 52., 69.],\n",
       "       [72., 66., 43.],\n",
       "       [89., 56., 13.],\n",
       "       [24., 75., 22.],\n",
       "       [75., 53., 99.],\n",
       "       [13., 88., 85.],\n",
       "       [ 4., 66., 41.],\n",
       "       [48., 46., 95.],\n",
       "       [39., 72., 89.],\n",
       "       [33., 37., 47.],\n",
       "       [48., 77., 11.],\n",
       "       [77., 36.,  9.],\n",
       "       [54., 10., 94.],\n",
       "       [76., 89., 67.],\n",
       "       [33., 58., 95.],\n",
       "       [59., 49., 25.],\n",
       "       [26., 74., 90.],\n",
       "       [67., 18., 26.],\n",
       "       [79., 15., 63.],\n",
       "       [54., 69., 53.],\n",
       "       [95., 19.,  6.],\n",
       "       [66.,  5., 98.],\n",
       "       [71., 22., 66.],\n",
       "       [86., 53., 61.],\n",
       "       [62.,  2., 15.],\n",
       "       [11., 59., 97.],\n",
       "       [30., 18., 67.],\n",
       "       [ 4., 32., 49.],\n",
       "       [ 9., 44., 37.],\n",
       "       [92., 11., 21.],\n",
       "       [57., 85., 14.],\n",
       "       [ 1., 21., 98.],\n",
       "       [29., 20., 78.],\n",
       "       [ 1., 95., 62.],\n",
       "       [ 5., 11., 97.],\n",
       "       [75.,  9., 30.],\n",
       "       [34., 60., 63.],\n",
       "       [24., 88., 53.],\n",
       "       [17.,  0., 20.],\n",
       "       [ 1.,  3., 26.],\n",
       "       [54., 60., 10.],\n",
       "       [ 2., 21., 69.],\n",
       "       [27., 66., 47.],\n",
       "       [55., 39., 49.],\n",
       "       [16., 36., 63.],\n",
       "       [ 5., 91., 16.],\n",
       "       [22.,  7., 19.],\n",
       "       [59.,  7., 75.],\n",
       "       [54., 88.,  5.],\n",
       "       [92., 12., 39.]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 按性别分组\n",
    "woman = np.empty(shape=(0,3))\n",
    "man = np.empty(shape=(0,3))\n",
    "for i in range(0,300):\n",
    "    if data[i,0] == 1:\n",
    "        woman = np.append(woman,[data[i,1:]],axis = 0)\n",
    "    if data[i,0] == 0:\n",
    "        man = np.append(man,[data[i,1:]],axis = 0)\n",
    "display(woman,man)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e0f8d85",
   "metadata": {},
   "source": [
    "女性各科成绩指标统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "9b0ffc2c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t女生各科成绩指标统计\n",
      "\tpython\t数学\t语文\n",
      "最小值\t 0.0 \t 2.0 \t 0.0\n",
      "最大值\t 99.0 \t 99.0 \t 99.0\n",
      "平均分\t 51.7 \t 48.3 \t 50.8\n",
      "中位数\t 51.5 \t 47.0 \t 52.5\n",
      "标准差\t 28.7 \t 26.3 \t 28.5\n"
     ]
    }
   ],
   "source": [
    "w_score_min = woman.min(axis = 0)  # 最小值\n",
    "w_score_max = woman.max(axis = 0)  # 最大值\n",
    "w_score_mean = woman.mean(axis = 0)  # 平均分\n",
    "w_score_median = np.median(woman,axis=0)  # 中位数\n",
    "w_score_std = woman.std(axis=0)  # 标准差\n",
    "print('\\t女生各科成绩指标统计')\n",
    "print('\\tpython\\t数学\\t语文')\n",
    "print('最小值\\t',w_score_min[0],'\\t',w_score_min[1],'\\t',w_score_min[2])\n",
    "print('最大值\\t',w_score_max[0],'\\t',w_score_max[1],'\\t',w_score_max[2])\n",
    "print('平均分\\t',round(w_score_mean[0],1),'\\t',round(w_score_mean[1],1),'\\t',round(w_score_mean[2],1))\n",
    "print('中位数\\t',w_score_median[0],'\\t',w_score_median[1],'\\t',w_score_median[2])\n",
    "print('标准差\\t',round(w_score_std[0],1),'\\t',round(w_score_std[1],1),'\\t',round(w_score_std[2],1))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af90a8ae",
   "metadata": {},
   "source": [
    "男性各科成绩指标统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "17ca2a14",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t男生各科成绩指标统计\n",
      "\tpython\t数学\t语文\n",
      "最小值\t 0.0 \t 0.0 \t 0.0\n",
      "最大值\t 99.0 \t 99.0 \t 99.0\n",
      "平均分\t 44.7 \t 43.2 \t 50.6\n",
      "中位数\t 44.5 \t 43.5 \t 53.0\n",
      "标准差\t 27.8 \t 26.7 \t 29.3\n"
     ]
    }
   ],
   "source": [
    "m_score_min = man.min(axis = 0)  # 最小值\n",
    "m_score_max = man.max(axis = 0)  # 最大值\n",
    "m_score_mean = man.mean(axis = 0)  # 平均分\n",
    "m_score_median = np.median(man,axis=0)  # 中位数\n",
    "m_score_std = man.std(axis=0)  # 标准差\n",
    "print('\\t男生各科成绩指标统计')\n",
    "print('\\tpython\\t数学\\t语文')\n",
    "print('最小值\\t',m_score_min[0],'\\t',m_score_min[1],'\\t',m_score_min[2])\n",
    "print('最大值\\t',m_score_max[0],'\\t',m_score_max[1],'\\t',m_score_max[2])\n",
    "print('平均分\\t',round(m_score_mean[0],1),'\\t',round(m_score_mean[1],1),'\\t',round(m_score_mean[2],1))\n",
    "print('中位数\\t',m_score_median[0],'\\t',m_score_median[1],'\\t',m_score_median[2])\n",
    "print('标准差\\t',round(m_score_std[0],1),'\\t',round(m_score_std[1],1),'\\t',round(m_score_std[2],1))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
